import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
Vue.use(ElementUI);

Vue.config.productionTip = false

Vue.prototype.$baseUrl = "http://192.168.60.15:30081/"
Vue.prototype.$http = axios


axios.defaults.baseURL = 'http://192.168.60.15:30081'
// axios.defaults.baseURL = 'http://192.168.60.15:30081'
Vue.prototype.$http = axios.create({
    baseURL: "http://192.168.60.15:30081/", // 方式二：通过/api别名指定后端路由
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        Accept: 'application/json'
    }
})
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  // 在发送请求之前做些什么
  return config
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error)
})
Vue.prototype.bus=new Vue()
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
